﻿(function ($) {

    var initialItem = function (target, settings) {
        var $target = $(target);

        var bindings = {};
        if (settings.detailEvent) {
            bindings.open = settings.detailEvent;
        }

        if (settings.deleteEvent) {
            bindings.remove = settings.deleteEvent;
        }

        $target.contextMenu('menu', {
            bindings: bindings
        });
        if (settings.hover != 'bigsize') {
            $target.hover(
                    function () {
                        $target.addClass('mouseover');
                        $target.parents('li').removeClass('mouseover');
                    }, 
                    function () {
                        $target.removeClass('mouseover');

                    });
        }
        else if (settings.hover == 'bigsize') {
            $target.hover(
                        function () {
                            $target.addClass('bigsizemouseover');
                        }, function () {
                            $target.removeClass('bigsizemouseover');

                        });
        }
       
    }

    jQuery.fn.addHoverFunctions = function (options) {
        settings = jQuery.extend({
            deleteEvent: null,
            detailEvent: null
        }, options);
        initialItem(this, settings);
        return this;
    };
})(jQuery);


